import { createApp } from 'vue'
// import './style.css'
import App from './App.vue'
import router from './router';
import axios from 'axios'

// 路由守卫，页面切换拦截
router.beforeEach((to, from)=>{
    if(to.path == '/RentRecord'){
        if(!sessionStorage.username){
            alert('请登录');
            location.href = '/Login';
            return false;
        }
    }
});

// // axios 请求拦截器
// axios.interceptors.request.use((config)=>{
//     config.headers = {
//         'username': sessionStorage.username
//     }
//     return config;
// }, (error)=>{
//     return Promise.reject(error);
// })

import { 
    NavBar,
    Tabbar, TabbarItem,
    Image,
    Popup,
    Cell, CellGroup,
    Field,
    DropdownMenu, DropdownItem,
    Calendar,
    Form,
} from 'vant';


createApp(App)
    .use(NavBar)
    .use(Tabbar)
    .use(TabbarItem)
    .use(Image)
    .use(Popup)
    .use(Cell)
    .use(CellGroup)
    .use(Field)
    .use(DropdownMenu)
    .use(DropdownItem)
    .use(Calendar)
    .use(Form)
    .use(router)
    .mount('#app')
